'use strict';
const mongoose = require('mongoose');

module.exports={
    async list(){
        let DockerModel=mongoose.models['Docker'];
        let dockers=await DockerModel.find({});
        return dockers;
    },
    async delete(options){
        let DockerModel=mongoose.models['Docker'];
        let docker=await DockerModel.findById(options._id);
        if(!docker){
            throw new Error('这个服务器不存在');
        }
        await DockerModel.deleteOne({_id:options._id});
    }
};